Install systemd units in the right location
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Mon, 12 Aug 2013 17:27:27 +0000 (19:27 +0200)
committerColin Walters <walters@verbum.org>
Thu, 15 Aug 2013 22:28:04 +0000 (18:28 -0400)
Debian uses /lib/systemd/system for system unit files, while i'm
putting ostree under the /usr prefix which means the hardcoded path
fails. Leave it to configure to work out the right location for systemd
units (method copied from pollkit).

Furthermore instead of installing the unit in local-fs.target.wants by
hand add a [Install] section so systemctl enable does the right thing

https://bugzilla.gnome.org/show_bug.cgi?id=705864

Makefile-dracut.am
configure.ac
src/dracut/ostree-remount.service

index 2837e98507f715648abd5ff8d7c3befa2be12c1e..d9e0dd4bcda87601ef28f82d33e511465763442b 100644 (file)
@@ -23,13 +23,7 @@ dracutmoddir = $(prefix)/lib/dracut/modules.d/98ostree
 dracutmod_SCRIPTS = src/dracut/module-setup.sh
 dracutmod_DATA = src/dracut/ostree-prepare-root.service
 
-systemdunitdir = $(prefix)/lib/systemd/system
-systemdunit_DATA = src/dracut/ostree-remount.service
-
-INSTALL_DATA_HOOKS += install-remount-service-data-hook
-install-remount-service-data-hook:
-       mkdir -p $(DESTDIR)$(systemdunitdir)/local-fs.target.wants/
-       ln -s ../ostree-remount.service $(DESTDIR)$(systemdunitdir)/local-fs.target.wants/ostree-remount.service
+systemdsystemunit_DATA = src/dracut/ostree-remount.service
 
 dracutconfdir = $(sysconfdir)/dracut.conf.d
 dracutconf_DATA = src/dracut/ostree.conf
index 675f76ecbb30605041e6db764ade39ccc5d0e884..cf50487084204de09f3177bcd1074e6ae58a86e2 100644 (file)
@@ -123,6 +123,16 @@ AC_ARG_WITH(dracut,
               [with_dracut=no])
 AM_CONDITIONAL(BUILDOPT_DRACUT, test x$with_dracut = xyes)
 
+AS_IF([test "x$with_dracut" = "xyes"], [
+  AC_ARG_WITH([systemdsystemunitdir],
+              AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
+              [],
+              [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
+  AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [
+    AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+  ])
+])
+
 AC_CONFIG_FILES([
 Makefile
 embedded-dependencies/Makefile
@@ -140,5 +150,8 @@ echo "
     libsoup (retrieve remote HTTP repositories): $with_soup
     libarchive (parse tar files directly): $with_libarchive
     documentation: $enable_documentation
-    dracut: $with_dracut
-"
+    dracut: $with_dracut"
+if test "x$with_dracut" = "xyes" ; then
+    echo "    systemd unit dir: $with_systemdsystemunitdir"
+fi
+echo ""
index 0c813ccb420cea112c8e907048f42b9470270f55..26b7d390f448d00e56670053d35563b6e2b06a51 100644 (file)
@@ -31,3 +31,6 @@ ExecStart=/usr/sbin/ostree-remount
 StandardInput=null
 StandardOutput=syslog
 StandardError=syslog+console
+
+[Install]
+WantedBy=local-fs.target